home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / CHASSIS_ / DRAWDEFA.C < prev    next >
Text File  |  1992-05-14  |  2KB  |  43 lines

  1. /************************************************************************************/
  2. /*    DrawDefaultBorder                                                                */
  3. /*                                                                                    */
  4. /*    This procedure draws a thick-line rounded rectangle in the userItem which        */
  5. /*    has been defined in the same area of the window as the default (item #1)        */
  6. /*    button.  The userItem must be defined large enough to contain the thick-line    */
  7. /*    rounded rectangle.                                                                */
  8. /*                                                                                    */
  9. /*    This procedure gets invoked repeatedly by the Dialog Manager while the dialog    */
  10. /*    is active.                                                                        */
  11. /*                                                                                    */
  12. /*    Note, parameter "itemNo" is the item number of the userItem, not of the default    */
  13. /*    Button.  "itemNo" isn't actually used in this procedure.                        */
  14. /************************************************************************************/
  15.  
  16. #include "MyHeaders.h"
  17.  
  18. pascal void DrawDefaultBorder(DialogPtr theDialog, short itemNo)
  19. {
  20.     GrafPtr        oldPort;
  21.     PenState    oldPen;
  22.     int            iType;
  23.     Handle        h;
  24.     Rect        box;
  25.  
  26.     GetPort(&oldPort);                            /* preserve current grafport        */
  27.     SetPort(theDialog);                            /* point to dialog grafport            */
  28.   
  29.     GetPenState(&oldPen);                        /* preserve current pen state        */
  30.     PenNormal();                                /* reset the pen state                */
  31.  
  32.     GetDItem(theDialog, 1, &iType, &h, &box);    /* get the default (#1) item's info    */
  33.  
  34.     PenSize(3,3);                                /* set thicker pen size                */
  35.       InsetRect(&box, -4, -4);                    /* inset outside of default item    */
  36.     FrameRoundRect(&box, 16, 16);                /* draw the border                    */
  37.  
  38.     SetPenState(&oldPen);                        /* restore the pen state            */
  39.     SetPort(oldPort);                            /* restore the current grafport        */
  40.     
  41.     return;
  42. }
  43.